<?php


namespace app\api\exception;


use think\exception\Handle;
use think\Response;
use Throwable;

class ApiException extends Handle
{
    public $httpStatus = 500;
    public function render($request, Throwable $e): Response
    {
        if (method_exists($e, "getStatusCode")) {
            $httpStatus = $e->getStatusCode();
        }
        return show(config("status.error"), $e->getMessage(), null, $httpStatus);
    }
}